package com.zjw.touchscreen.listener;

import android.annotation.SuppressLint;
import android.view.View;
import com.zjw.touchscreen.bluetooth.MouseHelper;

import java.util.concurrent.atomic.AtomicInteger;

@SuppressLint("NewApi")
public class TouchBoardClickListener implements View.OnClickListener {

    private AtomicInteger mark;

    public TouchBoardClickListener(AtomicInteger mark) {
        this.mark = mark;
    }

    @Override
    public void onClick(View v) {
        leftClick();
    }

    private void leftClick() {
        if (mark.get() != 0) {
            mark.set(0);
            return;
        }
        MouseHelper.sendData(true, false, false, 0, 0, 0);
        MouseHelper.sendKeyUp();
    }
}
